package userService

import (
	"gin-gorm-oj/models"
	"gin-gorm-oj/response"
	"github.com/gin-gonic/gin"
	"strconv"
)

func GetSetmealById(c *gin.Context) {
	setmealId, err := strconv.Atoi(c.Query("categoryId"))

	if err != nil {
		response.ResponseBadRequest(c)
		return
	}
	var setmeal []models.Setmeal
	db := models.Db.Model(new(models.Setmeal)).
		Preload("SetmealDishes")
	db.Where("id = ?", setmealId).Find(&setmeal)
	response.ResponseOK(c, setmeal)
	return

}
